package qianting.news.search.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import qianting.news.apis.models.search.dtos.UserSearchDto;
import qianting.news.common.entity.State;
import qianting.news.search.service.ArticleSearchService;

import java.io.IOException;

@Api(tags = "es搜索管理")
@RestController
@RequestMapping("/")
public class ArticleSearchController {

    @Autowired
    private ArticleSearchService articleSearchService;

    @ApiOperation(value = "es文章分页检索")
    @PostMapping("/es")
    public State search(@RequestBody UserSearchDto dto) throws IOException {
        return articleSearchService.search(dto);
    }

}
